{php include wl_template('common/header');}
<style type='text/css'>
	.trbody td {text-align: center; vertical-align:top;border-left:1px solid #ccc; border-bottom: 1px solid #ddd;}
</style>
<style>
	.order-rank img{width:16px; height:16px;}
	.js-remark,.js-admin-remark{word-break:break-all; overflow:hidden; background: #FDEEEE;color: #ED5050;padding: 5px 10px;}
	td.goods-info{position:relative; padding-left:60px;}
	.goods-info .img{position:absolute;top:50%; margin-top:-25px; background: url({IMAGE_LOADING}) center center no-repeat; width:50px;height:50px; }
	.goods-info span {white-space: nowrap;overflow: hidden;text-overflow: ellipsis;display: block;}
	.status-text{cursor:pointer;}
	.table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {border-top: 1px solid rgba(221, 221, 221, 0);}
	.col-md-1{padding-right: 0px;}
	.all-tips{
		margin-left: 65px;
	}
	span.effect-time {
		font-size: 12px;
		display: block;
		font-weight: 500;
	}
	.row.row-fix, .form-group.form-group-fix {
		margin-left: -15px;
		margin-right: -15px;
		width: 500px;
	}
	button.btn.btn-default.daterange.daterange-date {
		float: left;
		margin-left: 180px;
		position: absolute;
		z-index: 100;
	}
	#sel_child{
		display: none;
	}
	.show1{
		display: block;
	}
	.hide1{
		display: none;
	}

	.daterange-date{
		display: none;
	}
	.sty {
		display: block;
		width: 100%;
		font-size: 13px;
		height: 46px;
		overflow: hidden;
		white-space: nowrap;
		line-height: 46px;
		text-overflow: ellipsis;
		text-align: center;
	}
	.spe {
		display: inline-block;
		text-align: center;
		display: block;
		height: 33px;
		margin-left: -12px;
		padding-top: 0px;
		line-height: 33px;
	}
	.table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {
		white-space: normal;
	}
	span.ppp {
		text-align: center;
		display: inline-block;
		font-size: 14px;
		width: 100%;
		overflow: hidden;
		text-overflow: ellipsis;
		color: #e43;
	}
	.keyword{height: 32px;}

</style>
<div class="app-content">
	<div class="app-form">
		<div class="panel">
			<div class="panel-body">
				<form action="" method="get" class="form-horizontal" role="form" id="form1">
					<input type="hidden" name="c" value="site" />
					<input type="hidden" name="a" value="entry" />
					<input type="hidden" name="m" value="{MODULE_NAME}" />
					<input type="hidden" name="p" value="wlcoupon" />
					<input type="hidden" name="ac" value="couponlist" />
					<input type="hidden" name="do" value="orderlist" />
					<div class="form-group">
						<div class="col-md-2" id="double">
							{php echo tpl_form_field_category_2level('sel',$sel1, $sel2, $_GPC['sel']['parentid'], $_GPC['sel']['childid']);}
						</div>
						<div class="col-md-1 col-md-offset-1">
							<input type="text" name="keyword" value="{$_GPC['keyword']}" placeholder="请输入查询内容" class="keyword"{if $_GPC['sel']['parentid'] != 1 || $_GPC['sel']['parentid'] != 2} style="display: none;" {/if} autocomplete="off"/>
						</div>
						<div class="col-md-2">
							{php echo tpl_select_time_info('time_limit', array('starttime' => date('Y-m-d',$starttime), 'endtime' => date('Y-m-d', $endtime)));}
						</div>
						<div class="col-sm-9 pull-right">
							<div class="input-group">
								<span class="input-group-addon" id="search" style="border: 1px solid #999;width: 90px;cursor: pointer;display: block;margin-left: 29rem; border-radius: 3px;" >搜索</span>
							</div>
						</div>
					</div>
					<button style="position: relative;left: -15px;" class="btn btn-default min-width pull-right" name="export" type="submit" value="export"><i class="fa fa-download"></i> 导出订单</button>
				</form>
			</div>
		</div>
	</div>
	<script type="text/javascript">
        $("#search").click(function(){
            $('#form1')[0].submit();
        });
	</script>
	<div class="app-table-list">
		<div class="order-list">
			<div class="panel-body table-responsive collapse in" id="order-template-item-4" style="padding: 0;">
				<table class="table table-bordered">
					<thead style="background-color: #FFFFFF;">
					<tr>
						<th style="width:40px">序号</th>
						<th style="width:230px;text-align:center;">超级券信息</th>
						<th style="width:100px; text-align:center;">所属商家</th>
						<th style="width:200px; text-align:center;">用户信息</th>
						<th style="width:50px; text-align:center;">购买数量</th>
						<th style="width:80px; text-align: center;">订单价格</th>
						<th style="width:90px; text-align:center;">支付方式</th>
						<th style="width:160px; text-align:center;">支付时间</th>
					</tr>
					</thead>
				</table>
			</div>
			{loop $orders $y $item}
			<div class="panel panel-default">
				<div class="panel-heading clearfix" style="padding: 10px 15px;">
					<div class="pull-left">
						<span><a href="{php echo web_url('wlcoupon/couponlist/merbercoupon', array('orderno' => $item['orderno']))}" >订单用户记录查询</a></span>
					</div>
					<div class="pull-right">
						<span class="text-muted"></span>&nbsp;&nbsp;
						<a href="javascript:;" class="js-order-edit-remark" order-id="{$item['id']}">备注</a>
						<!--<a href="javascript:;" class="js-remove" order-id="{$item['id']}" >删除</a>-->
					</div>
				</div>
				<div class="panel-body table-responsive" style="padding: 0px;">
					<table class="table table-bordered">
						<tbody >
						<tr>
							<td style="width: 40px;" ><center>{php echo $y+1}</center></td>
							<td class="goods-info line-feed" style="width:230px;padding-left: 10px;">
								<div class="img"><img src="{IMAGE_PIXEL}" class="scrollLoading" data-url="{$item['logo']}" height="50" width="50" ></div>
								<div class="all-tips">
									<span class="">{$item['title']}</span>
								</div>
							</td>
							<td class="text-center" style="width:100px;;height:60px">
								<p>{$item['storename']}</p>
							</td>
							<td class="goods-info line-feed" style="width:200px; font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif ;">
							<div class="img"><img src="{IMAGE_PIXEL}" class="scrollLoading" data-url="{php echo tomedia($item['avatar'])}" height="50" width="50" ></div>
							<div class="all-tips">
								<span class="" style="position: relative;top: 10px;font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">{$item['nickname']}</span><br/>
								<span class="" style="font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;">{$item['mobile']}</span>
							</div>
							</td>
							<td class="text-center" style="width:50px;">
								{$item['num']}张
							</td>
							<td class="text-center" style="width:80px;">
								￥{$item['price']}
							</td>
							<!---->
							<td class="text-center" style="width:90px;">
								<span class="label label-success">微信支付</span>
							</td>
							<td class="text-center" style="width:160px;">
								<span class="effect-time">
								支付时间:{php echo date('Y-m-d H:i:s',$item['paytime'])} <br />
								</span>
							</td>
						</tr>
						</tbody>
					</table>
				</div>
				<div class="panel-heading clearfix js-admin-remark{$item['id']}" style="{if empty($item['remark'])}display: none;{/if}padding: 10px 15px;background-color:lightgoldenrodyellow;word-break: break-all;overflow: hidden;color: #ED5050;padding: 5px 10px;border-top:1px solid #ddd;">
					<div class="pull-left">
						<span>备注:<span id="js-admin-remark{$item['id']}">{$item['remark']}</span></span>
					</div>
				</div>
			</div>
			{/loop}
			{$pager}
		</div>
		</div>
	</div>
	<div id="modal-module-gift" class="modal fade" tabindex="-1">
		<div class="modal-dialog" style='width: 920px;'>
			<div class="modal-content">
				<div class="modal-header">
					<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
					<h3>我的备注</h3></div>
				<div class="modal-body">
					<div class="modal-body">
						<textarea id="remark" name="admin_remark" class="form-control" rows="5"></textarea>
					</div>
				</div>
				<div class="modal-footer" style="padding: 5px 15px;">
					<a class="btn btn-default js-cancel" aria-hidden="true" data-dismiss="modal">取消</a>
					<a class="btn btn-primary js-order-remark-post" order-id="" data-dismiss="modal" aria-hidden="true">确定</a>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	require(['jquery', 'util'], function($, util){
		$('.js-copy').each(function(){
			var id=$(this).attr('data-id');
			util.clip($("#js-copy"+id), $(this).attr('data-url'));
		});
	});
</script>
<script type="text/javascript">
	require(['jquery', 'util'], function($, util){
		$('.js-copy').each(function(){
			var id=$(this).attr('data-id');
			util.clip($("#js-copy"+id), $(this).attr('data-url'));
		});
	});
</script>
<script type="text/javascript">
	$(function(){
		$('[name="rank_all"]').click(function() {
			var checked = this.checked;
			$('.js-rank').find('input:checkbox').each(function() {
				this.checked = checked;
			});
		});
		$('#export').click(function() {
			if ($('[name="selecttime[start]"]').val() == '') {
				alert('请选择下单时间');
				$(this).focus();
				return false;
			};
			$(this).attr('type', 'submit').submit();
		});
		
		$('.order-rank').each(function(){
			o.rank(this);
		});
		
		//删除
		$('.order-list').delegate('.js-remove', 'click', function(e){
			e.stopPropagation();
			var $this = $(this);
			var id = $this.attr('order-id');
			util.nailConfirm(this, function(state) {
				if(!state) return;
				$.post("{php echo web_url('wlcoupon/couponlist/deleteOrder')}", { id : id }, function(data){
					if(!data.errno){
					$this.parent().parent().parent().remove();
					util.tips("删除成功！");
					};
				}, 'json');
			}, {html: '确认删除?'});
		});
	});
		
		// 修改备注
		$('.js-order-edit-remark').click(function(){
			var order_id = $(this).attr('order-id');
			var remarkvalue = $('#js-admin-remark'+order_id).text();
			$('.js-order-remark-post').attr("order-id",order_id);
			$('#remark').val(remarkvalue);
			popwin = $('#modal-module-gift').modal();
		});
		$('.js-cancel,.close').click(function() {
			$('#order-remark-container').hide();
			$('.main').css("opacity","1");$('.nav').css("opacity","1");$('.big-menu').css("opacity","1");
		});
		$('.js-order-remark-post').click(function() {
			var order_id = $(this).attr('order-id');
			var remark = $('#remark').val().trim();
			$.post("{php echo web_url('wlcoupon/couponlist/remark')}",{id:order_id,remark:remark},function(d){
				if(!d.errno){$('#js-admin-remark'+order_id).html(remark);}
			},"json");
			if (remark){
				$('.js-admin-remark'+order_id).show();
			}else{
				$('.js-admin-remark'+order_id).hide();
			}
			$('#order-remark-container').hide();
			$('.main').css("opacity","1");$('.nav').css("opacity","1");$('.big-menu').css("opacity","1");
		});




$('#sel_parent').click(function(){
	if(this.value==3){
		$('.daterange-date').show();
		$('.keyword').hide();
	}
	else if(this.value==1 || this.value==2){
		$('.daterange-date').hide();
		$('.keyword').show();
	}
});

$(function(){
	$('#sel_child').hide();
	if($('#sel_parent').val() == 1 || $('#sel_parent').val() == 2 ) {
		$('.keyword').show();
		$('.daterange-date').hide();
	}else if($('#sel_parent').val() == 3){
		$('.keyword').hide();
		$('.daterange-date').show();
	}
});




</script>
{php include wl_template('common/footer');}